﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;


namespace MakeReport
{
    public partial class Form_Show_Chart : Form
    {
        public Form_Show_Chart()
        {
            InitializeComponent();
            //Form1_load();
        }

        private DataTable CreateDataTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Date");
            dt.Columns.Add("Volume1");
            dt.Columns.Add("Volume2");
            dt.Columns.Add("Volume3");

            DataRow dr;

            dr = dt.NewRow();
            dr["Date"] = "Jan";
            dr["Volume1"] = 12333;
            dr["Volume2"] = 4111;
            dr["Volume3"] = 33;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["Date"] = "Feb";
            dr["Volume1"] = 7333;
            dr["Volume2"] = 5111;
            dr["Volume3"] = 73;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["Date"] = "Mar";
            dr["Volume1"] = 12333;
            dr["Volume2"] = 4111;
            dr["Volume3"] = 33;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["Date"] = "Apr";
            dr["Volume1"] = 7333;
            dr["Volume2"] = 5111;
            dr["Volume3"] = 73;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["Date"] = "May";
            dr["Volume1"] = 12333;
            dr["Volume2"] = 4111;
            dr["Volume3"] = 33;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["Date"] = "Jun";
            dr["Volume1"] = 7333;
            dr["Volume2"] = 5111;
            dr["Volume3"] = 73;
            dt.Rows.Add(dr);

            return dt;

        }
    
        private void Form_Show_Chart_load(object sender, EventArgs e)
        {
            DataTable dt = default(DataTable);
            dt = CreateDataTable();

            chart1.DataSource = dt;

            chart1.Series[0].YValueMembers = "Volume1";
            chart1.Series[1].YValueMembers = "Volume2";
            chart1.Series[2].YValueMembers = "Volume3";

            chart1.Series[1].XValueMember = "Date";

            string str = chart1.Series[0].YValueMembers.ToString();
            label1.Text = str;

            chart1.DataBind();
        }
    }
}
